using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using CustomCMS.API.Persistance;
using CustomCMS.API.Util;
using System.Configuration;

namespace CustomCMS.API
{
    public class CMSServer
    {
        /// <summary>
        /// Persisteance provider Factory
        /// </summary>
        /// <returns></returns>
        public static IPersistanceProvider GetProvider()
        {
            ConfigurationHandler config = (ConfigurationHandler)ConfigurationManager.GetSection("CustomCMS");

            string className = "CustomCMS.API.Persistance." + config.PersistanceProvider;

            return (IPersistanceProvider)System.Activator.CreateInstance(Type.GetType(className));
        }
    }
}
